<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="短信AK">
        <el-input type="text" v-model="form.sms_ak"></el-input>
      </el-form-item>
      <el-form-item label="短信SK">
        <el-input type="text" v-model="form.sms_sk"></el-input>
      </el-form-item>
      <el-form-item label="省厅AK">
        <el-input type="text" v-model="form.ser_ak"></el-input>
      </el-form-item>
      <el-form-item label="省厅SK">
        <el-input type="text" v-model="form.ser_sk"></el-input>
      </el-form-item>
      <el-form-item label="省厅地址">
        <el-input type="text" v-model="form.ser_domain"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import baseSettings from "@/api/systemManagement/baseSettings/index";

export default {
  name: "InterfaceSettings",
  data() {
    return {
      form: {
        sms_ak: "",
        sms_sk: "",
        ser_ak:"",
        ser_sk:"",
        ser_domain:""
      },
    };
  },
  created() {
    this.getData();
  },
  computed: {
  },
  methods: {
    getData() {
      baseSettings.getInterfaceInfo().then(res => {
        let info = eval("(" + res.data.value + ")");
        for (var o in this.form) {
          if (info[o]) {
            if (o == "logo") {
              this.logoFileList = info[o].map(item => {
                return { url: item };
              });
            } else {
              this.form[o] = info[o];
            }
          }
        }
      });
    },
    onSubmit() {
      baseSettings.settingsInterface(this.form).then(res => {
        this.msgSuccess("保存成功!");
      });
    },
  }
};
</script>
<style scoped>
.img-bg {
  background: #999999;
}
</style>
